package com.ld.security.server.admin.modules.ge.vo;

import com.ld.security.common.core.base.SuperVo;
import com.ld.security.common.core.util.StringUtil;
import com.ld.security.common.mybatis.anno.QueryKey;
import com.ld.security.common.mybatis.anno.RemoveKey;
import com.ld.security.common.mybatis.anno.SaveKey;
import com.ld.security.common.mybatis.anno.SqlKey;
import com.ld.security.common.mybatis.base.vo.ProxyVo;
import com.ld.security.common.mybatis.constant.SqlCondition;
import com.ld.security.server.admin.modules.ge.entity.*;
import lombok.Data;

import java.util.List;

@Data
public class ModelDetailVo implements SuperVo,ProxyVo {

  private String id;

  @QueryKey
  @SqlKey(name = "id",valueField = "id")
  @SaveKey
  @RemoveKey
  private GeModelEntity model;



  @SaveKey
  @RemoveKey
  @QueryKey
  @SqlKey(name = "modelId",valueField = "model.id",value = SqlCondition.in)

  private List<GeFieldEntity> fields;

  @SqlKey(name = "modelId",valueField = "model.id",value = SqlCondition.in)
  @RemoveKey
  @QueryKey
  private List<GeLinkEntity> links;

  @SqlKey(name = "modelId",valueField = "model.id",value = SqlCondition.in)
  @RemoveKey
  @QueryKey
  private List<GeChartEntity> charts;



  private List<EarlyDetailsVo.EarlyDetails> earlyModels;




  @Override
  public void queryAfter() {


    fields.sort((x,y) -> {
      return  x.getSortVal() - y.getSortVal() ;
    });



  }
}
